package cn.edu.neu.softlab633.influencemaximization.sy.bean;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * Created by Jason on 2017/5/11.
 */
public class Index {
    private Map<Integer, Map<Integer, Double[]>> index;

    public Index(Map<Integer, Map<Integer, Double[]>> index) {
        this.index = index;
    }

    public Index() {
        index = new HashMap<>();
    }

    public void setIndex(Map<Integer, Map<Integer, Double[]>> index) {
        this.index = index;
    }

    public Map<Integer, Map<Integer, Double[]>> getIndex() {
        return index;
    }

    public ArrayList<Integer> getNode(Integer id) {
        ArrayList<Integer> nodes = new ArrayList<>();
        if (index.get(id) != null) {
            for (Iterator<Integer> iterator = index.get(id).keySet().iterator(); iterator.hasNext(); ) {
                Integer next = iterator.next();
                nodes.add(next);
            }
        }
        return nodes;
    }
}
